using MicroMsg.Common.Event;
using MicroMsg.Common.Utils;
using MicroMsg.Manager;
using MicroMsg.Storage;
using MicroMsg.UI.UserContrl;
using MicroMsg.UI.Util;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace MicroMsg.UI.Page
{
	public class TestContactItemPage : BasePage
	{
		private const string TAG = "TestContactItemPage";
		private const int cNPageArgCnt = 1;
		private static int nCnt;
		private int int_0;
		private int int_1;
		private bool mBIsFirstLoaded = true;
		private Contact mContact;
		private EventWatcher mWatchxxx;
		private object mObjectWatcher = new object();
		internal ScrollViewer svRoot;
		internal StackPanel panelRoot;
		private bool _contentLoaded;
		public TestContactItemPage()
		{
			this.InitializeComponent();
			TestContactItemPage.nCnt++;
		}
		private Contact getCon()
		{
			if (ContactsView.sListGroup != null && ContactsView.sListGroup.get_Count() != 0)
			{
				if (this.int_0 < 0 || this.int_0 >= ContactsView.sListGroup.get_Count())
				{
					this.int_0 = 0;
				}
				while (this.int_0 < ContactsView.sListGroup.get_Count())
				{
					if (this.int_0 != 1)
					{
						if (this.int_0 != 2)
						{
							Group<Contact> group = ContactsView.sListGroup.get_Item(this.int_0);
							if (group != null && group.get_Count() != 0)
							{
								if (this.int_1 < group.get_Count())
								{
									return group.get_Item(this.int_1++);
								}
								this.int_1 = 0;
							}
							this.int_0++;
							continue;
						}
					}
					this.int_0++;
				}
				return null;
			}
			return null;
		}
		private UIElement getUIElement()
		{
			if (TestContactItemPage.nCnt % 2 == 0)
			{
				EmojiTextNotCut emojiTextNotCut = new EmojiTextNotCut();
				emojiTextNotCut.FontSize = 24.0;
				emojiTextNotCut.set_MaxWidth(400.0);
				emojiTextNotCut.Text = "测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试";
				EmojiTextNotCut arg_4B_0 = emojiTextNotCut;
				SolidColorBrush solidColorBrush = new SolidColorBrush();
				solidColorBrush.set_Color(Colors.get_Green());
				arg_4B_0.Foreground = solidColorBrush;
				return emojiTextNotCut;
			}
			EmojiText emojiText = new EmojiText();
			emojiText.FontSize = 24.0;
			emojiText.set_MaxWidth(400.0);
			emojiText.Text = "测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试";
			EmojiText arg_94_0 = emojiText;
			SolidColorBrush solidColorBrush2 = new SolidColorBrush();
			solidColorBrush2.set_Color(Colors.get_Green());
			arg_94_0.Foreground = solidColorBrush2;
			return emojiText;
		}
		protected override void OnPageLoaded(object sender, RoutedEventArgs e)
		{
			if (this.mBIsFirstLoaded)
			{
				this.mBIsFirstLoaded = false;
				for (int i = 0; i < 30; i++)
				{
					this.panelRoot.get_Children().Add(this.getUIElement());
				}
			}
			Log.smethod_5("TestContactItemPage", "Page_Loaded");
		}
		protected override void OnPageUnLoaded(object sender, RoutedEventArgs e)
		{
			Log.smethod_5("TestContactItemPage", "Page_Unloaded");
		}
		protected override void OnPageIn(object[] object_0)
		{
			Log.smethod_5("TestContactItemPage", "OnPageIn");
			if (object_0 != null && 1 == object_0.Length)
			{
				if (object_0[0].GetType() == typeof(string))
				{
					string gparam_ = object_0[0] as string;
					this.mContact = StorageMgr.contact.method_0(gparam_);
					return;
				}
			}
		}
		protected override void OnPageOut()
		{
			Log.smethod_5("TestContactItemPage", "OnPageOut");
		}
		protected override void OnPageBack()
		{
			Log.smethod_5("TestContactItemPage", "OnPageBack");
		}
		private void registerEvent()
		{
			if (this.mWatchxxx == null)
			{
				this.mWatchxxx = new EventWatcher(this.mObjectWatcher, null, new EventHandlerDelegate(this.Onxxx));
				EventCenter.registerEventWatcher(EventConst.ON_STORAGE_CONTACT_ADD, this.mWatchxxx);
			}
		}
		private void unRegisterEvent()
		{
			if (this.mWatchxxx != null)
			{
				EventCenter.removeEventWatcher(EventConst.ON_STORAGE_CONTACT_ADD, this.mWatchxxx);
				this.mWatchxxx = null;
			}
		}
		private void Onxxx(EventWatcher watcher, BaseEventArgs evtArgs)
		{
			if (evtArgs == null)
			{
				return;
			}
		}
		private void initUI()
		{
		}
		protected override void OnBackKeyPress(CancelEventArgs cancelEventArgs_0)
		{
		}
		public static void GotoThisPage(object object_0)
		{
			object[] object_ = new object[]
			{
				object_0
			};
			ToolFunction.GotoPageForUserControl("/Source/UI/LogView/TestContactItemPage.xaml", object_, false);
		}
		private void Button_Click(object sender, RoutedEventArgs e)
		{
			SnsSetOutGroupPage.GotoThisPage();
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/UI/LogView/TestContactItemPage.xaml", 2));
			this.svRoot = (ScrollViewer)base.FindName("svRoot");
			this.panelRoot = (StackPanel)base.FindName("panelRoot");
		}
	}
}
